package com.xiongwei.memento;

/**
 * @author XiongWei
 * @date 2024/2/19
 */
public class GameRole {

    private int attack;

    private int defense;

    public int getAttack() {
        return attack;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    public int getDefense() {
        return defense;
    }

    public void setDefense(int defense) {
        this.defense = defense;
    }

    public Memento createMemento() {
        return new Memento(attack,defense);
    }

    public void recoverFromMemento(Memento memento) {
        this.attack = memento.getAttack();
        this.defense = memento.getDefense();
    }

    public void display() {
        System.out.println("当前攻击：" + attack + "防御：" + defense);
    }
}
